<?php

namespace App\Utils;

use Hyperf\Context\Context;

class ContextUtil
{

    public static function setUser(array $user)
    {
        Context::set('login_user', $user);
    }

    public static function getUser()
    {
        return Context::get('login_user');
    }

    public static function getUserId()
    {
        return Context::get('login_user')['id'] ?? null;
    }

    public static function setAdmin(array $admin)
    {
        Context::set('login_admin', $admin);
    }

    public static function getAdmin()
    {
        return Context::get('login_admin');
    }

    public static function getAdminId()
    {
        return Context::get('login_admin')['id'] ?? null;
    }

    public static function setPathInfo($pathInfo)
    {
        return Context::set('path_info', $pathInfo);
    }

    public static function getPathInfo()
    {
        return Context::get('path_info');
    }
}